//
//  BCConfirmOrder.m
//  BangcaiBuy
//
//  Created by lsy on 16/6/21.
//  Copyright © 2016年 BCB. All rights reserved.
//

#import "BCConfirmOrder.h"
#import "BCShopInfoCell.h"
#import "BCPayStyleCell.h"
#import "BCGetStuffStyle.h"
#import "BCOrderRessultCell.h"
#import "BCOrderConfirmListCell.h"
@interface BCConfirmOrder ()<UITableViewDelegate, UITableViewDataSource>
@property(nonatomic, strong)UITableView *table;
@end

@implementation BCConfirmOrder

- (void)createView
{
    self.table = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT - 50) style:UITableViewStylePlain];
    self.table.delegate = self;
    self.table.dataSource = self;
    self.table.separatorStyle = UITableViewCellSeparatorStyleNone;
    [self addSubview:self.table];
    [self.table registerClass:[BCShopInfoCell class] forCellReuseIdentifier:@"info"];
    [self.table registerClass:[BCPayStyleCell class] forCellReuseIdentifier:@"style"];
    [self.table registerClass:[BCGetStuffStyle class] forCellReuseIdentifier:@"stuff"];
    [self.table registerClass:[BCOrderConfirmListCell class] forCellReuseIdentifier:@"list"];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 4;
    
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.row == 0) {
        return 100;
    }else if (indexPath.row == 1) {
        return 95;
    }else if (indexPath.row == 2) {
        return 260;
    }else{
        return  [BCOrderViewManager readStuffFromOrder].count *20 + 300;
    }
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

{
    if (indexPath.row == 0) {
        BCShopInfoCell *cell = [tableView dequeueReusableCellWithIdentifier:@"info"];
        cell.name = @"刘先生";
        cell.phone = @"152********";
        cell.address = @"辽宁省大连市中山区XXXXXXX";
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        return cell;

    }else if (indexPath.row == 1) {
        BCPayStyleCell *cell = [tableView dequeueReusableCellWithIdentifier:@"style"];
      
        cell.selectionStyle = UITableViewCellSelectionStyleNone;

        return cell;

    }else if (indexPath.row == 2) {

        BCGetStuffStyle *cell = [tableView dequeueReusableCellWithIdentifier:@"stuff"];
            cell.selectionStyle = UITableViewCellSelectionStyleNone;

        return cell;

    }else{
         BCOrderConfirmListCell *cell = [tableView dequeueReusableCellWithIdentifier:@"list"];
       
        cell.selectionStyle = UITableViewCellSelectionStyleNone;

        return cell;

    }

    
}

@end
